﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Text;
using Lib.Utils;

namespace MS.INV.Systems
{
    public class Options
    {
        public static string TenQuan { get; set; }
        public static string DiaChi { get; set; }
        public static string DienThoai { get; set; }
        public static string CPU { get; set; }
        public static string Url { get; set; }
        public static string CurrentVerion { get; set; }
        public static string LocalUpdatePath { get; set; }
        public static bool AutoUpdateFromInternet { get; set; }
        public static bool KeyValidate { get; set; }
        public static string KeyCode { get; set; }


        public static void LoadOption()
        {
            using (ZZ_System sys = new ZZ_System())
            {
                sys.LoadData(4);
                Lib.Utils.Uti.KeyEncrypt = sys.Agr5;
                Lib.Lic.Infos.Port = Lib.Lic.Test.ReTest(sys.Agr1, true);
                Lib.Lic.Infos.Smtp = Lib.Lic.Test.ReTest(sys.Agr2, true);

                Lib.Lic.Infos.Email = Lib.Lic.Test.ReTest(sys.Agr3, true);
                Lib.Lic.Infos.EUnlock = Lib.Lic.Test.ReTest(sys.Agr4, true);

                sys.LoadData(3);
                TenQuan = sys.Agr1;
                DiaChi = sys.Agr2;
                DienThoai = sys.Agr3;
                Lib.Data.ConnInfo.Max_Computers = Cvert.ToInt32(Lib.Lic.Test.ReTest(sys.Agr4, true), 0);
                Lib.Data.ConnInfo.Max_Rows = Cvert.ToInt32(Lib.Lic.Test.ReTest(sys.Agr5, true), 0);

                sys.LoadData(5);
                CPU = sys.Agr1;
                KeyValidate = Cvert.ToBoolean(sys.Agr2, true);
                CurrentVerion = sys.Agr3;
                LocalUpdatePath = sys.Agr4;
                AutoUpdateFromInternet = Convert.ToBoolean(sys.Agr5);

                sys.LoadData(6);
                Url = sys.Agr1;
                KeyCode = sys.Agr2;
            }
        }
    }
}
